//时间选择就不多说了,mui框架自带,重点是城市
var start_time_picker = new mui.DtPicker({"type":"date","beginYear":1960,"endYear":2020});
$("#useData").on("tap", function(){
setTimeout(function(){
start_time_picker.show(function(items){
$("#useData_id").val(items.text);
$("#useData").html(items.text);
});
},200);
});
//选择省市区
var city_picker = new mui.PopPicker({layer:3});
city_picker.setData(init_city_picker);
$("#city_text").on("tap", function(){
setTimeout(function(){
city_picker.show(function(items){
$("#city_id").val((items[0] || {}).value "," (items[1] || {}).value "," (items[2] || {}).value);//该ID为接收城市ID字段
$("#city_text").html((items[0] || {}).text " " (items[1] || {}).text " " (items[2] || {}).text);
});
},200);
});
//选择省市
var city_picker1 = new mui.PopPicker({layer:2});
city_picker1.setData(init_city_picker);
$("#city_text1").on("tap", function(){
setTimeout(function(){
city_picker1.show(function(items){
$("#city_id1").val((items[0] || {}).value "," (items[1] || {}).value);
$("#city_text1").html((items[0] || {}).text " " (items[1] || {}).text);
});
},200);
});
//选择省
var city_picker2 = new mui.PopPicker({layer:1});
city_picker2.setData(init_city_picker);
$("#city_text2").on("tap", function(){
setTimeout(function(){
city_picker2.show(function(items){
$("#city_id2").val((items[0] || {}).value);
$("#city_text2").html((items[0] || {}).text);
});
},200);
});
评论